sleep = (time) => new Promise(resolve => {
    console.log(time, 'ms之后执行了...');
    setTimeout(() => resolve(time), time);
});

function mergePromise(arr) {
    const result = [];
    return new Promise(resolve => {
        let promise = Promise.resolve();
        arr.forEach((item) => {
            promise = promise.then(() => item()).then((res) => result.push(res));
        });
        promise.then(() => resolve(result));
    });
}

mergePromise([() => sleep(1000), () => sleep(2000), () => sleep(3000)]).then(res => {
    console.log(res);
});